<template>
  <ForkUniDataPicker
    ref="forkUniDataPickerRef"
    :options="options"
    :popupTitle="popupTitle"
    :placeholder="placeholder"
    :heightMobile="heightMobile"
    :readonly="readonly"
    :clearIcon="clearIcon"
    :border="border"
    :split="split"
    :ellipsis="ellipsis"
    :localdata="localdata"
    :spaceInfo="spaceInfo"
    :collection="collection"
    :action="action"
    :field="field"
    :orderby="orderby"
    :where="where"
    :pageData="pageData"
    :pageCurrent="pageCurrent"
    :pageSize="pageSize"
    :getcount="getcount"
    :getone="getone"
    :gettree="gettree"
    :manual="manual"
    v-model:value="value"
    v-model="modelValue"
    :preload="preload"
    :selfField="selfField"
    :parentField="parentField"
    :multiple="multiple"
    :map="map"
    v-bind="$attrs"
  ></ForkUniDataPicker>
</template>
<script>
export default {
  inheritAttrs: false,
};
</script>
<script setup>
import { ref, getCurrentInstance } from "vue";
import ForkUniDataPicker from "./components/uni-data-picker/uni-data-picker.vue";
const props = defineProps({
  options: {
    type: [Object, Array],
    default() {
      return {};
    },
  },
  popupTitle: {
    type: String,
    default: "请选择",
  },
  placeholder: {
    type: String,
    default: "请选择",
  },
  heightMobile: {
    type: String,
    default: "",
  },
  readonly: {
    type: Boolean,
    default: false,
  },
  clearIcon: {
    type: Boolean,
    default: true,
  },
  border: {
    type: Boolean,
    default: true,
  },
  split: {
    type: String,
    default: "/",
  },
  ellipsis: {
    type: Boolean,
    default: true,
  },
  /////////////////
  localdata: {
    type: [Array, Object],
    default() {
      return [];
    },
  },
  spaceInfo: {
    type: Object,
    default() {
      return {};
    },
  },
  collection: {
    type: String,
    default: "",
  },
  action: {
    type: String,
    default: "",
  },
  field: {
    type: String,
    default: "",
  },
  orderby: {
    type: String,
    default: "",
  },
  where: {
    type: [String, Object],
    default: "",
  },
  pageData: {
    type: String,
    default: "add",
  },
  pageCurrent: {
    type: Number,
    default: 1,
  },
  pageSize: {
    type: Number,
    default: 20,
  },
  getcount: {
    type: [Boolean, String],
    default: false,
  },
  getone: {
    type: [Boolean, String],
    default: false,
  },
  gettree: {
    type: [Boolean, String],
    default: false,
  },
  manual: {
    type: Boolean,
    default: false,
  },
  value: {
    type: [Array, String, Number],
    default() {
      return [];
    },
  },
  modelValue: {
    type: [Array, String, Number],
    default() {
      return [];
    },
  },
  preload: {
    type: Boolean,
    default: false,
  },
  stepSearh: {
    type: Boolean,
    default: true,
  },
  selfField: {
    type: String,
    default: "",
  },
  parentField: {
    type: String,
    default: "",
  },
  multiple: {
    type: Boolean,
    default: false,
  },
  map: {
    type: Object,
    default() {
      return {
        text: "text",
        value: "value",
      };
    },
  },
});
const forkUniDataPickerRef = ref(null);
const show = () => {
  forkUniDataPickerRef.value.show();
};
const hide = () => {
  forkUniDataPickerRef.value.hide();
};
const clear = () => {
  forkUniDataPickerRef.value.clear();
};
//const {change,nodeclick,stepsearch,popupopened,popupclosed} = curInstance.$attrs
</script>
<style lang="scss" scoped></style>
